home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 April: Mac OS SDK / Dev.CD Apr 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / CIncludes / CTBUtilities.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  5.6 KB  |  223 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        CTBUtilities.h
  3.  
  4.      Contains:    Communications Toolbox Utilities interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1988-1993, 1995-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __CTBUTILITIES__
  18. #define __CTBUTILITIES__
  19.  
  20. #ifndef __CONDITIONALMACROS__
  21. #include <ConditionalMacros.h>
  22. #endif
  23. #ifndef __MACTYPES__
  24. #include <MacTypes.h>
  25. #endif
  26. #ifndef __MIXEDMODE__
  27. #include <MixedMode.h>
  28. #endif
  29. #ifndef __DIALOGS__
  30. #include <Dialogs.h>
  31. #endif
  32. #ifndef __APPLETALK__
  33. #include <AppleTalk.h>
  34. #endif
  35.  
  36.  
  37.  
  38. #if PRAGMA_ONCE
  39. #pragma once
  40. #endif
  41.  
  42. #ifdef __cplusplus
  43. extern "C" {
  44. #endif
  45.  
  46. #if PRAGMA_IMPORT
  47. #pragma import on
  48. #endif
  49.  
  50. #if PRAGMA_STRUCT_ALIGN
  51.     #pragma options align=mac68k
  52. #elif PRAGMA_STRUCT_PACKPUSH
  53.     #pragma pack(push, 2)
  54. #elif PRAGMA_STRUCT_PACK
  55.     #pragma pack(2)
  56. #endif
  57.  
  58.  
  59. enum {
  60.     curCTBUVersion                = 2                                /* version of Comm Toolbox Utilities*/
  61. };
  62.  
  63.  
  64. enum {
  65.                                                                 /*    Error codes/types    */
  66.     ctbuGenericError            = -1,
  67.     ctbuNoErr                    = 0
  68. };
  69.  
  70. typedef OSErr                             CTBUErr;
  71.  
  72. enum {
  73.     chooseDisaster                = -2,
  74.     chooseFailed                = -1,
  75.     chooseAborted                = 0,
  76.     chooseOKMinor                = 1,
  77.     chooseOKMajor                = 2,
  78.     chooseCancel                = 3
  79. };
  80.  
  81. typedef unsigned short                     ChooseReturnCode;
  82.  
  83. enum {
  84.     nlOk                        = 0,
  85.     nlCancel                    = 1,
  86.     nlEject                        = 2
  87. };
  88.  
  89. typedef unsigned short                     NuLookupReturnCode;
  90.  
  91. enum {
  92.     nameInclude                    = 1,
  93.     nameDisable                    = 2,
  94.     nameReject                    = 3
  95. };
  96.  
  97. typedef unsigned short                     NameFilterReturnCode;
  98.  
  99. enum {
  100.     zoneInclude                    = 1,
  101.     zoneDisable                    = 2,
  102.     zoneReject                    = 3
  103. };
  104.  
  105. typedef unsigned short                     ZoneFilterReturnCode;
  106.  
  107. enum {
  108.                                                                 /*    Values for hookProc items        */
  109.     hookOK                        = 1,
  110.     hookCancel                    = 2,
  111.     hookOutline                    = 3,
  112.     hookTitle                    = 4,
  113.     hookItemList                = 5,
  114.     hookZoneTitle                = 6,
  115.     hookZoneList                = 7,
  116.     hookLine                    = 8,
  117.     hookVersion                    = 9,
  118.     hookReserved1                = 10,
  119.     hookReserved2                = 11,
  120.     hookReserved3                = 12,
  121.     hookReserved4                = 13,                            /*    "virtual" hookProc items    */
  122.     hookNull                    = 100,
  123.     hookItemRefresh                = 101,
  124.     hookZoneRefresh                = 102,
  125.     hookEject                    = 103,
  126.     hookPreflight                = 104,
  127.     hookPostflight                = 105,
  128.     hookKeyBase                    = 1000
  129. };
  130.  
  131.  
  132. /*    NuLookup structures/constants    */
  133.  
  134. struct NLTypeEntry {
  135.     Handle                             hIcon;
  136.     Str32                             typeStr;
  137. };
  138. typedef struct NLTypeEntry                NLTypeEntry;
  139.  
  140. typedef NLTypeEntry                     NLType[4];
  141.  
  142. struct NBPReply {
  143.     EntityName                         theEntity;
  144.     AddrBlock                         theAddr;
  145. };
  146. typedef struct NBPReply                    NBPReply;
  147. typedef CALLBACK_API( short , DialogHookProcPtr )(short item, DialogPtr theDialog);
  148. typedef CALLBACK_API( short , NameFilterProcPtr )(const EntityName *theEntity)/*  (22) added const */;
  149. typedef CALLBACK_API( short , ZoneFilterProcPtr )(ConstStr32Param theZone);
  150. typedef STACK_UPP_TYPE(DialogHookProcPtr)                         DialogHookUPP;
  151. typedef STACK_UPP_TYPE(NameFilterProcPtr)                         NameFilterUPP;
  152. typedef STACK_UPP_TYPE(ZoneFilterProcPtr)                         ZoneFilterUPP;
  153. enum { uppDialogHookProcInfo = 0x000003A0 };                     /* pascal 2_bytes Func(2_bytes, 4_bytes) */
  154. enum { uppNameFilterProcInfo = 0x000000E0 };                     /* pascal 2_bytes Func(4_bytes) */
  155. enum { uppZoneFilterProcInfo = 0x000000E0 };                     /* pascal 2_bytes Func(4_bytes) */
  156. #define NewDialogHookProc(userRoutine)                             (DialogHookUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppDialogHookProcInfo, GetCurrentArchitecture())
  157. #define NewNameFilterProc(userRoutine)                             (NameFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppNameFilterProcInfo, GetCurrentArchitecture())
  158. #define NewZoneFilterProc(userRoutine)                             (ZoneFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppZoneFilterProcInfo, GetCurrentArchitecture())
  159. #define CallDialogHookProc(userRoutine, item, theDialog)         CALL_TWO_PARAMETER_UPP((userRoutine), uppDialogHookProcInfo, (item), (theDialog))
  160. #define CallNameFilterProc(userRoutine, theEntity)                 CALL_ONE_PARAMETER_UPP((userRoutine), uppNameFilterProcInfo, (theEntity))
  161. #define CallZoneFilterProc(userRoutine, theZone)                 CALL_ONE_PARAMETER_UPP((userRoutine), uppZoneFilterProcInfo, (theZone))
  162. EXTERN_API( CTBUErr )
  163. InitCTBUtilities                (void);
  164.  
  165. EXTERN_API( short )
  166. CTBGetCTBVersion                (void);
  167.  
  168. EXTERN_API( short )
  169. StandardNBP                        (Point                     where,
  170.                                  ConstStr255Param         prompt,
  171.                                  short                     numTypes,
  172.                                  NLType                 typeList,
  173.                                  NameFilterUPP             nameFilter,
  174.                                  ZoneFilterUPP             zoneFilter,
  175.                                  DialogHookUPP             hook,
  176.                                  NBPReply *                theReply);
  177.  
  178. EXTERN_API( short )
  179. CustomNBP                        (Point                     where,
  180.                                  ConstStr255Param         prompt,
  181.                                  short                     numTypes,
  182.                                  NLType                 typeList,
  183.                                  NameFilterUPP             nameFilter,
  184.                                  ZoneFilterUPP             zoneFilter,
  185.                                  DialogHookUPP             hook,
  186.                                  long                     userData,
  187.                                  short                     dialogID,
  188.                                  ModalFilterUPP         filter,
  189.                                  NBPReply *                theReply);
  190.  
  191. #if OLDROUTINENAMES
  192. #define NuLookup(where, prompt, numTypes, typeList, nameFilter, zoneFilter,    \
  193. hook, theReply)                                                                \
  194. StandardNBP(where, prompt, numTypes, typeList, nameFilter, zoneFilter,         \
  195. hook, theReply)
  196. #define NuPLookup(where, prompt, numTypes, typeList, nameFilter,                 \
  197. zoneFilter, hook, userData, dialogID, filter, theReply)                        \
  198. CustomNBP(where, prompt, numTypes, typeList, nameFilter,                         \
  199. zoneFilter, hook, userData, dialogID, filter, theReply)
  200. #endif  /* OLDROUTINENAMES */
  201.  
  202.  
  203. #if PRAGMA_STRUCT_ALIGN
  204.     #pragma options align=reset
  205. #elif PRAGMA_STRUCT_PACKPUSH
  206.     #pragma pack(pop)
  207. #elif PRAGMA_STRUCT_PACK
  208.     #pragma pack()
  209. #endif
  210.  
  211. #ifdef PRAGMA_IMPORT_OFF
  212. #pragma import off
  213. #elif PRAGMA_IMPORT
  214. #pragma import reset
  215. #endif
  216.  
  217. #ifdef __cplusplus
  218. }
  219. #endif
  220.  
  221. #endif /* __CTBUTILITIES__ */
  222.  
  223.